package com.dingwen.treasure.model.entity.mybatisplus;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 系统表基本实体 </br>
 * @author dingwen
 * @date 2022/04/30
 */
@ApiModel(value = "baseEntity",description = "系统基础实体")
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity extends Model implements  Serializable {

    private static final long serialVersionUID = 1651101251741493252L;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    protected LocalDateTime createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.UPDATE)
    protected LocalDateTime updateTime;

    /**
     * 是否进行删除
     */
    @ApiModelProperty(value = "逻辑删除标识,1:存在,2:已删除")
    @TableLogic(value = "1",delval = "2")
    protected Integer deleted;

    /**
     * 版本（默认值：0） </br>
     * <p>若数据库中 version 为空，会导致乐观锁失效</p>
     */
    @ApiModelProperty(value = "版本号（悲观锁）")
    @Version
    protected Integer version;
    /**
     * 创建者
     */
    @ApiModelProperty(value = "创建者")
    protected String createBy;


    /**
     * 更新者
     */
    @ApiModelProperty(value = "更新者")
    protected String updateBy;


    @ApiModelProperty(value = "备注")
    protected String remark;
}
